<?php 
	header("Content-type: text/html; charset=utf-8"); 
	include("common/conn.php");

	$parrent = "/(href|images)([\"|']?)([^\"'>]+.(jpg|JPG|jpeg|JPEG|gif|GIF|png|PNG))/i";
	$allResult = mysql_query("select content,goodsid from goods where content != ''");
	
	if($allResult){
		while ($value = mysql_fetch_array($allResult)) {
			
			
			$content = $value['content'];
			if($content != ''){
				$goodsid = $value['goodsid'];
				preg_match_all($parrent, $content, $m);
				if(count($m[0])>0){
					$src = implode($m[0], ',');
					$re = mysql_query("update goods set xiangQingTu = '".$src."' where goodsid = ".$goodsid);
					if($re){
						echo "商品id:".$goodsid."详情图装换成功<br/>";
					}
				}
			}

				
		}
	}
	

 ?>